// 
//  Copyright 2011  comphilip
// 
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
// 
//        http://www.apache.org/licenses/LICENSE-2.0
// 
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
using System;
using System.IO;

namespace Dict4Engkoo {
	/// <summary>
	/// DICT processor interface
	/// </summary>
	public interface IDictProcessor {
		/// <summary>Call when new connection established.</summary>
		/// <param name="Context">A <see cref="DictContext"/></param>
		void StartProcessor(DictContext Context);
		
		/// <summary>Process DICT command</summary>
		/// <param name="Context">A <see cref="DictContext"/></param>
		void ProcessCommand(DictContext Context);
		
		/// <summary>Begins an asynchronous ProcessCommand operation</summary>
		/// <param name="Context">A <see cref="DictContext"/></param>
		/// <param name="Callback">An optional asynchronous callback, to be called when the read is complete. </param>
		/// <param name="State">A user-provided object that distinguishes this particular asynchronous read request from other requests.</param>
		/// <returns>An <see cref="IAsyncResult"/>that represents the asynchronous process command, which could still be pending.</returns>
		IAsyncResult BeginProcessCommand(DictContext Context, AsyncCallback Callback, object State);
		
		///<summary>Waits for the pending asynchronous ProcessCommand to complete.</summary>
		///<param name="AR">The reference to the pending asynchronous request to finish. </param>
		void EndProcessCommand(IAsyncResult AR);
	}
}

